<h3>
    Books ({{itemCount}})

    <div class="col-xs-6 pull-right list-search">
        <a
            data-ng-if="user.admin"
            data-ui-sref="examples.book.add"
            data-tooltip="Add new book"
        ><i class="fa fa-plus-circle"></i></a>

        <list-search
            data-filters="filters"
            data-options="itemsPerPageOptions"
            data-items="itemsPerPage"
        ></list-search>

        <pagination class="pagination-sm"
            data-total-items="itemCount"
            data-ng-model="currentPage"
            data-items-per-page="itemsPerPage"
            data-max-size="10"
            data-boundary-links="true"
            data-rotate="false"
        ></pagination>
    </div>
</h3>

<table class="table">
    <thead class="no-select">
        <tr>
            <th class="text-nowrap {{item.class}}"
                data-ng-repeat="item in titleItems"
            >
                <a
                    data-ng-show="item.column"
                    data-ng-click="changeSort(item)"
                    data-ng-bind-html="item.title"
                ></a>
                <span
                    data-ng-show="!item.column"
                    data-ng-bind-html="item.title"
                ></span>

                <i class="fa"
                    data-ng-show="sort.column == item.column"
                    data-ng-class="{'fa-angle-down': !sort.direction, 'fa-angle-up': sort.direction}"
                ></i>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr
            data-ng-repeat="book in items"
        >
            <td class="col-md-9">
                <a data-ui-sref="examples.book({id: book.id})">{{book.title}}</a>
            </td>
            <td class="col-md-2">
                <a data-ui-sref="examples.author({id: getAuthor(book.author, 'id')})"
                   data-ng-show="getAuthor(book.author, 'id', true) !== true"
                >
                    {{getAuthor(book.author, 'name')}}
                </a>
            </td>
            <td class="col-md-1 text-right">{{book.releaseDate | amDateFormat: 'YYYY'}}</td>
        </tr>

        <tr data-ng-if="items.length === 0">
            <td colspan="100%" class="text-center text-muted">
                <em>no data founded...</em>
            </td>
        </tr>
    </tbody>
</table>

<pagination class="pagination-sm pull-right"
    data-total-items="itemCount"
    data-ng-model="currentPage"
    data-items-per-page="itemsPerPage"
    data-max-size="10"
    data-boundary-links="true"
    data-rotate="false"
></pagination>